Passed
Pull Request — master (#188)
by Mathieu
02:03
created

IsProjectAlreadyExist   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A isSatisfiedBy 0 4 1
1
import {Inject} from '@nestjs/common';
2
import {IProjectRepository} from 'src/Domain/Project/Repository/IProjectRepository';
3
import {Project} from 'src/Domain/Project/Project.entity';
4
5
export class IsProjectAlreadyExist {
6
  constructor(
7
    @Inject('IProjectRepository')
8
    private readonly projectRepository: IProjectRepository
9
  ) {}
10
11
  public async isSatisfiedBy(name: string): Promise<boolean> {
12
    return (
13
      (await this.projectRepository.findOneByName(name)) instanceof Project
14
    );
15
  }
16
}
17